<?  
	require("required/dbconnect.php"); 
	require("required/function.php");


	
	if(isset($_POST['add_on_id']) && isset($_POST['product_id']))
	{
		$action=$_POST['action'];
		$from_product_id=$_POST['product_id'];
		if($action==1)
		{
			$add_on_id=$_POST['add_on_id'];
			$product_id=$_POST['product_id'];
		}else{
			$add_on_id=$_POST['product_id'];
			$product_id=$_POST['add_on_id'];
		}
				
		if($add_on_id==$product_id)
		{
			header("Location:product_viewfull.php?id=$from_product_id&updated=7");	
		}
		else
		{
			$chk=mysql_query("select count(*) as result from os_product_add_on where product_id='$product_id' and add_on_id='$add_on_id' ");
		
			if(mysql_result($chk,0,"result")>0)
			{
				header("Location:product_viewfull.php?id=$from_product_id&updated=6");	
			}
			else
			{
				mysql_query("insert into os_product_add_on(add_on_id,product_id)values('".$add_on_id."','".$product_id."')")or die(mysql_error());	
				header("Location:product_viewfull.php?id=$from_product_id&updated=5");
			}
		}
	}
	else
	{
		die("illegal access");
	}

	

	

?>





      

  